﻿<KCtl:BaseUserControl x:Class="Kiva7.Pages.LenderControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:KCtl="clr-namespace:Kiva7.Controls"
    
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid>

        <ProgressBar Visibility="{Binding IsLoaded, Converter={StaticResource booleanToNotVisibility}}" 
                     IsIndeterminate="{Binding IsLoaded, Converter={StaticResource notBooleanConverter}}" 
                     Style="{StaticResource CustomIndeterminateProgressBar}"
                     VerticalAlignment="Center" />

        <ScrollViewer Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">
            <Grid Background="{StaticResource KivaBackgroundBrush}" 
                  DataContext="{Binding SingleData}"
                  Style="{StaticResource KivaDetailStyle}">

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*"  />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition ></ColumnDefinition>
                    <ColumnDefinition MaxWidth="200" ></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <StackPanel Style="{StaticResource KivaPanelTextLargeStyle}" Grid.Row="0" Grid.ColumnSpan="2" Margin="12,0">
                    <TextBlock Text="{Binding Name}" Style="{StaticResource KivaTextLargeStyle}"
                           TextWrapping="Wrap"/>
                </StackPanel>


                <StackPanel x:Name="LayoutRoot" Grid.Column="0" Grid.Row="1">

                    <TextBlock x:Name="LenderID" Text="{Binding UID}" Visibility="Collapsed"/>

                    <TextBlock x:Name="tbkMemberSinceLabel" 
                               Text="{Binding Path=L.MemberSince, Source={StaticResource L}}"  
                               Visibility="{Binding MemberSince, Converter={StaticResource dateTimeVisibility}}"
                               Style="{StaticResource KivaTextNormalStyle}"/>
                    <TextBlock x:Name="tbkMemberSince" Text="{Binding MemberSince, Converter={StaticResource toShortDate}}" 
                           Style="{StaticResource KivaTextAccentStyle}"
                       Visibility="{Binding MemberSince, Converter={StaticResource dateTimeVisibility}}"
                           TextWrapping="Wrap"/>

                    <TextBlock x:Name="tbkWhereAboutsLabel" 
                               Text="{Binding Path=L.WhereAbouts, Source={StaticResource L}}"  
                               Style="{StaticResource KivaTextNormalStyle}"
                               Visibility="{Binding WhereAbouts, Converter={StaticResource stringVisibility}}" />
                    <TextBlock x:Name="tbkWhereAbouts" Text="{Binding WhereAbouts}" 
                           Visibility="{Binding WhereAbouts, Converter={StaticResource stringVisibility}}"
                           Style="{StaticResource KivaTextAccentStyle}"
                           TextWrapping="Wrap"/>

                    <TextBlock x:Name="tbkOccupationLabel" Text="{Binding Path=L.Occupation, Source={StaticResource L}}"  Style="{StaticResource KivaTextNormalStyle}"
                       Visibility="{Binding Occupation, Converter={StaticResource stringVisibility}}" />
                    <TextBlock x:Name="tbkOccupation" Text="{Binding Occupation}" 
                           Visibility="{Binding Occupation, Converter={StaticResource stringVisibility}}"
                           Style="{StaticResource KivaTextAccentStyle}"
                           TextWrapping="Wrap"
                       />

                    <TextBlock x:Name="tbkPersonalUrlLabel" Text="{Binding Path=L.Url, Source={StaticResource L}}"  Style="{StaticResource KivaTextNormalStyle}"
                       Visibility="{Binding PersonalUrl, Converter={StaticResource stringVisibility}}"/>
                    <TextBlock x:Name="tbkPersonalUrl" Text="{Binding PersonalUrl}" Style="{StaticResource KivaTextAccentStyle}"
                           Visibility="{Binding PersonalUrl, Converter={StaticResource stringVisibility}}"
                           TextWrapping="Wrap"/>

                    <TextBlock x:Name="tbkInviteesCountLabel" Text="{Binding Path=L.Invitees, Source={StaticResource L}}"  
                               Visibility="{Binding InviteeCount, Converter={StaticResource numberVisibility}}"
                               Style="{StaticResource KivaTextNormalStyle}"/>
                    <TextBlock x:Name="tbkInviteesCount" Text="{Binding InviteeCount}" 
                               Style="{StaticResource KivaTextAccentStyle}"
                               Visibility="{Binding InviteeCount, Converter={StaticResource numberVisibility}}"/>

                    <TextBlock Text="{Binding Path=L.Loans, Source={StaticResource L}}"  
                               Style="{StaticResource KivaTextNormalStyle}"
                               Visibility="{Binding LoanCount, Converter={StaticResource numberVisibility}}"/>
                    <TextBlock Text="{Binding LoanCount}" 
                               Style="{StaticResource KivaTextAccentStyle}"
                               Visibility="{Binding LoanCount, Converter={StaticResource numberVisibility}}"/>


                </StackPanel>
                <StackPanel Grid.Column="1" Grid.Row="1">
                    <Button Click="Button_Click_1" BorderThickness="0" Margin="0,0,0,0">
                        <KCtl:KivaImageControl x:Name="imgLender" ImageSize="Normal" ImageData="{Binding Image}" Width="210" Height="210" HorizontalAlignment="Right" 
                       VerticalAlignment="Top" 
                   Visibility="{Binding Image, Converter={StaticResource objectVisibility}}"/>
                    </Button>
                </StackPanel>

                <StackPanel Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2">
                    <TextBlock x:Name="tbkLoanBecauseLabel" Text="{Binding Path=L.LoanBecause, Source={StaticResource L}}"  Style="{StaticResource KivaTextNormalStyle}"
                       Visibility="{Binding LoanBecause, Converter={StaticResource stringVisibility}}"/>
                    <KCtl:TranslationControl x:Name="tbkLoanBecause" 
                                             TextStyle="{StaticResource KivaTextAccentStyle}"
                          DataContext="{Binding LoanBecauseTranslation}" 
                          Visibility="{Binding LoanBecause, Converter={StaticResource stringVisibility}}" />

                    <TextBlock x:Name="tbkOccupationalInfoLabel" Text="{Binding Path=L.OccupationalInfo, Source={StaticResource L}}"  Style="{StaticResource KivaTextNormalStyle}"
                       Visibility="{Binding OccupationalInfo, Converter={StaticResource stringVisibility}}" />
                    <KCtl:TranslationControl x:Name="tbkOccupationalInfo" 
                                             TextStyle="{StaticResource KivaTextAccentStyle}"
                           DataContext="{Binding OccupationalInfoTranslation}" 
                           Visibility="{Binding OccupationalInfo, Converter={StaticResource stringVisibility}}"/>
                </StackPanel>

            </Grid>
        </ScrollViewer>
    </Grid>
</KCtl:BaseUserControl>
